<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.apache.commons.dbcp.BasicDataSource" %>
<%
//获取参数
final String field = request.getParameter("ziduan");

ApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext());
org.springframework.orm.hibernate3.HibernateTemplate ht =(org.springframework.orm.hibernate3.HibernateTemplate) context.getBean("hibernateTemplate");
List list = ht.executeFind(new org.springframework.orm.hibernate3.HibernateCallback() {
		public Object doInHibernate(org.hibernate.Session s) throws org.hibernate.HibernateException,
				java.sql.SQLException {
			org.hibernate.Query query = s.createSQLQuery("select "+field+" from purejsp");
			java.util.List list = query.list();
			return list;
		}
});
	
for(Object obj : list){
	out.write(obj.toString());
	out.write("&nbsp;&nbsp;&nbsp;&nbsp;");
}

%>

<%--以上是在jsp代码片段中实现数据库查询的代码，而JSTL是可以让jsp代码片段都消失的技术，是jsp代码片段的进化 --%>
